package com.rahwi.rahwi_server.Controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.rahwi.rahwi_server.Handler.Security.Security;
import com.rahwi.rahwi_server.vo.params.ReplyParams;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Scope(value = "prototype")
@RequestMapping("/reply")
public class ReplyController {

    @Security
    @PostMapping("/add")
    public void addReply(@RequestBody ReplyParams reply){
        ObjectMapper mapper = new ObjectMapper();
        try {
            String json = mapper.writeValueAsString(reply.getContent());
            System.out.println(json);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
    }
}
